#ifndef JUDGE_NAMESPACE_MANAGER_H
#define JUDGE_NAMESPACE_MANAGER_H

#include <string>
#include <vector>

namespace judge {

struct MountPoint {
    std::string source;
    std::string target;
    std::string fstype;
    unsigned long flags;
};

class NamespaceManager {
public:
    NamespaceManager();
    NamespaceManager(const std::string& root_dir);
    ~NamespaceManager();

    void setRootDirectory(const std::string& path);
    void addMountPoint(const std::string& source, const std::string& target, 
                      const std::string& fstype, unsigned long flags);

    // Initialize namespaces before fork
    bool initializeNamespaces();
    
    // Initialize filesystem after fork
    void initializeFilesystem();

    // Original initialize method (deprecated)
    void initialize();

    void cleanup();

private:
    std::string root_dir_;
    std::vector<MountPoint> mount_points_;

#ifdef __linux__
    void setupRootDirectory();
    void performMounts();
#endif
};

} // namespace judge

#endif // JUDGE_NAMESPACE_MANAGER_H 